const path = require('path');
const webpack = require('webpack');
const resolve = function(dir) {
  return path.join(__dirname, dir);
}
module.exports = {
  devServer: {
    port: 10001,
    disableHostCheck: true,
    proxy: 'https://pms.xiaojushou.com/',
  },
  publicPath: '/demo/',
  outputDir: 'demo',
  runtimeCompiler: true,

  css: {
    sourceMap: true,
    loaderOptions: {
      sass: {
        // @/ 是 src/ 的别名
        // 所以这里假设你有 `src/variables.sass` 这个文件
        // 注意：在 sass-loader v8 中，这个选项名是 "prependData"
        additionalData: `@import "~@/styles/element-variables.scss"`,
      }
    }
  },
  chainWebpack: config=>{
    // 全局路由 @ 自定义匹配 $精准匹配
    // https://webpack.docschina.org/configuration/resolve/#resolvealias
    config.resolve.alias.set('@$',resolve('src'));
    // config.module.rule('vue').use('vue-loader').end();
    config.module.rule('scss').test(/\.scss$/).end().loaders = ['style', 'css', 'sass'];

    config.plugin('provide').use(webpack.ProvidePlugin, [{
      'window.Quill': 'quill/dist/quill.js',
      'Quill': 'quill/dist/quill.js'
    }]);
  },
    configureWebpack: {
      plugins: [
        new webpack.ProvidePlugin({
          'window.Quill': 'quill/dist/quill.js',
          'Quill': 'quill/dist/quill.js',
        })
      ]
    },

};
